﻿using PetaPoco;
using PmSoft;
using PmSoft.Caching;
using System.ComponentModel;

namespace Modules.Project
{
    /// <summary>
    /// 项目完工信息表
    ///</summary>
    [TableName("project_completed")]
    [Description("项目完工信息表,项目完工申请,审批")]
    [PrimaryKey("id", AutoIncrement = true)]
    [CacheSetting(true)]
    [Serializable]
    public class ProjectCompleted : IEntity
    {
        /// <summary>
        /// 主键
        ///</summary>
        [Column("id")]
        public int Id { get; set; }

        /// <summary>
        /// 项目ID
        ///</summary>
        [Column("project_id")]
        public int ProjectId { get; set; }

        /// <summary>
        /// 专户Id
        /// </summary>
        [Column("account_id")]
        public int AccountId { get; set; }

        /// <summary>
        /// 保证金缴纳信息Id
        /// </summary>
        [Column("guarantee_payment_id")]
        public int GuaranteePaymentId { get; set; }

        /// <summary>
        /// 申请理由
        ///</summary>
        [Column("apply_reason")]
        public string ApplyReason { get; set; }

        /// <summary>
        /// 申请状态
        ///</summary>
        [Column("audit_type")]
        public ProjectConstants.完工销户申请状态 AuditType { get; set; }

        /// <summary>
        /// 实际竣工日期
        ///</summary>
        [Column("end_date")]
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 退还保证金
        ///</summary>
        [Column("refund_amount")]
        public decimal? RefundAmount { get; set; }

        /// <summary>
        /// 可退还金额
        ///</summary>
        [Column("refundable_amount")]
        public decimal? RefundableAmount { get; set; }

        /// <summary>
        /// 审核/退还原因说明
        ///</summary>
        [Column("refund_reason")]
        public string RefundReason { get; set; }

        /// <summary>
        /// 创建时间
        ///</summary>
        [Column("create_time")]
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 最后更新时间
        ///</summary>
        [Column("last_update_time")]
        public DateTime? LastUpdateTime { get; set; }

        #region IEntity 成员

        [Ignore]
        object IEntity.EntityId { get { return this.Id; } }

        #endregion IEntity 成员
    }
}